import os
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', 'lotto.catalog.views.current', name='home'),
    (r'^accounts/', include('registration.backends.default.urls')),
    (r'^profile/', include('lotto.profile.urls')),
    (r'^search/', include('lotto.search.urls')),
    (r'^stats/', include('lotto.statistic.urls')),
    (r'^catalog/', include('lotto.catalog.urls')),
    (r'^service/', include('lotto.service.urls')),
    (r'^admin/', include(admin.site.urls)),
)

#Aby media dzialaly na developerskim servie
if True:
     from django.views.static import serve
     _media_url = '/media/';
     if _media_url.startswith('/'):
         _media_url = _media_url[1:]
         urlpatterns += patterns('',
                                 (r'^%s(?P<path>.*)$' % _media_url,
                                 serve,
                                 {'document_root': os.path.join (os.path.abspath (os.path.dirname (__file__)), 'media')}))
     del(_media_url, serve)
